<?php
/**
 * Theme's Index Page
 *
 *
 * @file           index.php
 * @package        WordPress 
 * @subpackage     Shell 
 * @author          Emil Uzelac, nofearinc
 * @copyright      2003 - 2012 ThemeID, 2013 DevWP
 * @license        license.txt
 * @version        Release: 1.0
 * @filesource     wp-content/themes/shell-lite/index.php
 * @link           http://codex.wordpress.org/Theme_Development#Index_.28index.php.29
 * @since          available since Release 1.0
 */
?>

<?php get_header(); ?>
 <div class="layout layout1 mt5">
        <div class="main mt15">
            <div class="f_out flexslider">
                <ul class="smpc fr">
                 <?php				           
	                query_posts('posts_per_page=4&orderby=post_date');
	                if(have_posts()):;								
						while(have_posts()):
						the_post();
						?>
						<li class="mt1"><a href="<?php echo the_permalink();?>" target="_blank"><?php echo getFirstImage(get_the_ID(),120,80)?></a></li>								
						<?php 
						endwhile;;
					 endif;
					 wp_reset_query(); 
					 ?>
                </ul>
                <ul class="bigpc fl slides">
                 	<?php				           
	                query_posts('posts_per_page=4&orderby=post_date');
	                if(have_posts()):;								
						while(have_posts()):
						the_post();
						?>
						<li><a href="<?php echo the_permalink();?>" target="_blank"><?php echo getFirstImage(get_the_ID(),500,324)?></a></li>								
						<?php 
						endwhile;;
					 endif;
					 wp_reset_query(); 
					 ?>
                </ul>                    
            </div>
            <div style="clear:both"></div>
             <div class="zxcy mt10">
            	<div class="hd">
                    <h2>最热创意</h2>
                </div>
                <div class="bd">
                    <div class="tody_news">
                    <ul class="newslist">
            <?php 
	            //$wp_query = new WP_Query();
				query_posts('v_sortby=views&v_orderby=desc&posts_per_page=8&paged=1');				
				if(have_posts()):
					$i=0;
					while(have_posts()):
						$i++;
						the_post();
						$post_title =get_the_title();
						if($i==1||$i==5){
							echo '<li class="title"><a href="'.the_permalink().'" target="_blank" title="'.get_the_title().'">'.get_the_title().'</a></li>';
						}else{
							echo '<li ><a href="'.the_permalink().'" target="_blank" title="'.get_the_title().'">'.get_the_title().'</a></li>';
						}
						
/*						if($i==1||$i==5||$i==9||$i==13){
							if($i==1){echo '<div class="tody_news">';}
							if($i==9){echo '<div class="tody_news ml20">';}
							if($i==5||$i==13){echo '</ul>';}				
							
							echo '<h4><a href="'.the_permalink().'" target="_blank" title="'.get_the_title().'">'.get_the_title().'</a></h4><ul class="newslist">';
						}else{
							echo '<li><a href="'.the_permalink().'" target="_blank" title="'.get_the_title().'">'.get_the_title().'</a></li>';
							
							if($i==8){echo '</ul></div>';}
							if($i==16){echo '</ul>';}
						}	*/					
					endwhile;
				 endif;
				 wp_reset_query();           
            ?>
            </ul>
             </div>
             <div class="tody_news ml20">
                    <ul class="newslist">
            <?php 
	            //$wp_query = new WP_Query();
				query_posts('v_sortby=views&v_orderby=desc&posts_per_page=8&paged=2');				
				if(have_posts()):
					$i=0;
					while(have_posts()):
						$i++;
						the_post();
						$post_title =get_the_title();
						if($i==1||$i==5){
							echo '<li class="title"><a href="'.the_permalink().'" target="_blank" title="'.get_the_title().'">'.get_the_title().'</a></li>';
						}else{
							echo '<li ><a href="'.the_permalink().'" target="_blank" title="'.get_the_title().'">'.get_the_title().'</a></li>';
						}
						
/*						if($i==1||$i==5||$i==9||$i==13){
							if($i==1){echo '<div class="tody_news">';}
							if($i==9){echo '<div class="tody_news ml20">';}
							if($i==5||$i==13){echo '</ul>';}				
							
							echo '<h4><a href="'.the_permalink().'" target="_blank" title="'.get_the_title().'">'.get_the_title().'</a></h4><ul class="newslist">';
						}else{
							echo '<li><a href="'.the_permalink().'" target="_blank" title="'.get_the_title().'">'.get_the_title().'</a></li>';
							
							if($i==8){echo '</ul></div>';}
							if($i==16){echo '</ul>';}
						}	*/					
					endwhile;
				 endif;
				 wp_reset_query();           
            ?>
            </ul>
             </div></div>
			</div>
           
        
        </div> 
        <div class="sidebar">
            <div class="gzwm">
                <div class="hd">
                    <h2>关注我们</h2>
                </div>
                <div class="bd mt10">
                    <a href="#" class="f1"><span>微博</span></a>
                    <a href="#" class="f2"><span>豆瓣</span></a>
                    <a href="#" class="f3"><span>微信</span></a>
                    <a href="#" class="f4"><span>订阅</span></a>
                </div>
            </div>
            <div class="djdxh mt10">
                <div class="hd">
                    <h2>大家都喜欢</h2>
                </div>       
                <div class="bd">
                    <div class="newslist">
                        <ul>                        	
			                <?php				           
			                query_posts('posts_per_page=5&orderby=post_date');
			                if(have_posts()):;								
								while(have_posts()):
								the_post();
								?>
								<li>								
								<a class="pic" target="_blank" href="<?php echo the_permalink();?>"><?php echo getFirstImage(get_the_ID())?></a>
								<p class="title"><a target="_blank" href="<?php echo the_permalink();?>"><?php echo mb_strimwidth(strip_tags(get_the_title()), 0, 45); ?></a></p>
								<div class="info cf">
									<div class="fl">
										<span><?php echo to_friend_time(get_the_time("Y-m-d H:i:s"))?></span>
									</div>
									<div class="plBtn">
										<a href="#" class="xh">3</a>
									</div>
								</div>
								</li>
								<?php 
								endwhile;;
							 endif;
							 wp_reset_query(); 
							 ?>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        

	<div style="clear:both"></div>
    <div class="layout layout2 mt20">
    <div class="hd">
        <h2>创意家居</h2>
        <b></b>
        <a class="more" target="_blank" href="<?php echo get_category_link(1)?>">阅读全部</a>
    </div>
    <?php query_posts('posts_per_page=4&orderby=post_date');
    	if(have_posts()):
    	$num = 0;   
    ?>
    <div class="bd cyjj">
   
    <?php  
    	while(have_posts()):
    	the_post();
    	$num++;
    	if($num==1):?>
        <div class="left">
            <ul>
                <li>
                    <a href="<?php echo the_permalink();?>" target="_blank"><?php echo getFirstImage(get_the_ID(),256,126)?></a>
                    <p><a href="<?php echo the_permalink();?>" target="_blank" title="<?php echo get_the_title();?>"><?php echo get_the_title();?></a></p>
                </li>
        <?php endif;
        if($num==2):
        ?>
                <li class="mt10">
                    <a href="<?php echo the_permalink();?>" target="_blank"><?php echo getFirstImage(get_the_ID(),256,126)?></a>
                    <p><a href="<?php echo the_permalink();?>" target="_blank" title="<?php echo get_the_title();?>"><?php echo get_the_title();?></a></p>
                </li>
            </ul>
        </div>
   	 <?php  endif; if($num==3):?>
        <div class="app mid">
            <h3>
                <a href="<?php echo the_permalink();?>" target="_blank" title="<?php echo get_the_title();?>"><?php echo mb_strimwidth(strip_tags(get_the_title()), 0, 50); ?></a>
            </h3>
            <div class="tplist">
                <a class="pic" href="<?php echo the_permalink();?>" target="_blank"><?php echo getFirstImage(get_the_ID(),166,240)?></a>
                <p><?php echo mb_strimwidth(strip_tags(get_the_excerpt()), 0, 170,"……"); ?></p>
                <div class="shareTo mt10" style="display:none;">
                    <div class="shareBtn">
                        <span class="shareshowbtn">
                            <img width="14" height="14" src="<?php bloginfo("template_url")?>/images/sharebtn.png" />分享
                        </span>
                        <div class="share" style="display:block">
                            <a class="sharewb" href="#">分享到微薄</a>
                            <a class="shareqzone" href="#">分享到空间</a>
                            <a class="sharesina" href="#">分享到新浪微博</a>
                            <a class="shareqqemail" href="#">分享到QQ邮箱</a>
                            <a class="sharerenren" href="#">分享到人人</a>
                            <a class="sharekaixin" href="#">分享到开心</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?php endif; if($num==4):?>
        <div class="app right">
            <h3>
                <a href="<?php echo the_permalink();?>" target="_blank" title="<?php echo get_the_title();?>"><?php echo mb_strimwidth(strip_tags(get_the_title()), 0, 50); ?></a>
            </h3>
            <div class="tplist">
                <a class="pic" href="<?php echo the_permalink();?>" target="_blank"><?php echo getFirstImage(get_the_ID(),166,240)?></a>
                <p><?php echo mb_strimwidth(strip_tags(get_the_excerpt()), 0, 170,"……"); ?></p>
                <div class="shareTo mt10" style="display:none;">
                    <div class="shareBtn">
                        <span class="shareshowbtn">
                            <img width="14" height="14" src="<?php bloginfo("template_url")?>/images/sharebtn.png" />分享
                        </span>
                        <div class="share" style="display:none">
                            <a class="sharewb" href="#">分享到微薄</a>
                            <a class="shareqzone" href="#">分享到空间</a>
                            <a class="sharesina" href="#">分享到新浪微博</a>
                            <a class="shareqqemail" href="#">分享到QQ邮箱</a>
                            <a class="sharerenren" href="#">分享到人人</a>
                            <a class="sharekaixin" href="#">分享到开心</a>
                        </div>
                    </div>
                </div>
            </div>            	
        </div>
        <?php endif;endwhile;?>
                
    </div>
    <?php endif;wp_reset_query(); ?>
    </div>
    <div class="layout layout3 mt10">
    <div class="xxsm sidebar">
        <div class="hd">
            <h2>新鲜数码</h2>
             <a class="more" target="_blank" href="<?php echo get_category_link(1)?>">阅读全部</a>     
        </div>
        <div class="bd">
            <div class="newslist">
            <ul>
            <?php            				           
                query_posts('posts_per_page=3&orderby=post_date');;
                if(have_posts()):							
			   		while(have_posts()):
					the_post();
					?>
               <li>
                    <a href="<?php echo the_permalink();?>" target="_blank" class="pic"><?php echo getFirstImage(get_the_ID(),150,100)?></a>
                    <p class="title">
                        <a href="<?php echo the_permalink();?>" target="_blank" title="<?php echo get_the_title();?>"><?php echo get_the_title();?></a>
                    </p>
                    <p class="content"><?php echo mb_strimwidth(strip_tags(get_the_excerpt()), 0, 120,"……"); ?></p>                    
                </li>
                <?php endwhile;endif;wp_reset_query();?>
            </ul>
            </div>
        </div>
    </div>
    <div class="xqbg main">
        <div class="hd"> 
            <h2>稀奇办公</h2>
             <a class="more" target="_blank" href="<?php echo get_category_link(1)?>">阅读全部</a>
        </div>
        <div class="bd">
        	<?php         	          				           
                query_posts('posts_per_page=8&orderby=post_date');
                if(have_posts()):$num = 0; 							
			   		while(have_posts()):
					the_post();
					$num++;
					if($num==1){echo '<ul class="mt20">';}
					if($num==5) { echo '</ul><ul class="list">';}
					if($num<5):
					?>
				
				<li <?php echo $num%2==1?'class="mr20"':''?>>
                    <a href="<?php echo the_permalink();?>" target="_blank" class="pic"><?php echo getFirstImage(get_the_ID(),220,120)?></a>
                    <p><a href="<?php echo the_permalink();?>" target="_blank" title="<?php echo get_the_title();?>"><?php echo mb_strimwidth(strip_tags(get_the_title()), 0, 30); ?></a></p>
                </li>
                
            <?php else:?>
            	<li <?php echo $num%2==1?'class="mr20"':''?>>
                    <a href="<?php echo the_permalink();?>" target="_blank" title="<?php echo get_the_title();?>"><?php echo mb_strimwidth(strip_tags(get_the_title()), 0, 28); ?></a>
                </li>
         <?php endif; endwhile;
         	echo '</ul>';
            endif;wp_reset_query();?>     
        </div>
    </div>
    </div>
    <div class="layout layout2 mt10">
    <div class="hd">
        <h2>概念设计</h2>
        <b></b>
        <a class="more" target="_blank" href="<?php echo get_category_link(1)?>">阅读全部</a>
    </div>
    <div class="bd glsj">
        <ul>
       		<?php         	          				           
                query_posts('posts_per_page=5&orderby=post_date');
                if(have_posts()): $num=0;						
			   		while(have_posts()):
					the_post();
					$num++;
					?>
				<li <?php echo $num==5?'class="last"':''?>>
	                 <a href="<?php echo the_permalink();?>" target="_blank" class="pic"><?php echo getFirstImage(get_the_ID(),176,176)?></a>
                	 <p><a href="<?php echo the_permalink();?>" target="_blank" title="<?php echo get_the_title();?>"><?php echo mb_strimwidth(strip_tags(get_the_title()), 0, 24); ?></a></p>
	                 
	            </li>
            <?php endwhile;endif;wp_reset_query();?>
        </ul>
    </div>
    </div>
    <div class="layout layout3 mt10">
	    <div class="xxsm sidebar">
	        <div class="hd">
	            <h2>手工制作</h2>
	             <a class="more" target="_blank" href="<?php echo get_category_link(1)?>">阅读全部</a>     
	        </div>
	        <div class="bd">
	            <div class="newslist">
	            <ul>
	              <?php            				           
	               query_posts('posts_per_page=3&orderby=post_date');
	                if(have_posts()):							
				   		while(have_posts()):
						the_post();
						?>
	               <li>
	                    <a href="<?php echo the_permalink();?>" target="_blank" class="pic"><?php echo getFirstImage(get_the_ID(),150,100)?></a>
	                    <p class="title">
	                        <a href="<?php echo the_permalink();?>" target="_blank" title="<?php echo get_the_title();?>"><?php echo get_the_title();?></a>
	                    </p>
	                    <p class="content"><?php echo mb_strimwidth(strip_tags(get_the_excerpt()), 0, 120,"……"); ?></p>
	                    <!--<div class="info cf">
	                        <div class="fl">
	                            <span><?php the_time('m年d日 H:i')?></span>
	                        </div>
	                        <div class="plBtn">
	                            <a href="#" class="xh">3</a>
	                        </div>
	                    </div>-->
	                </li>
	                <?php endwhile;endif;wp_reset_query();?>
	            </ul>
	            </div>
	        </div>
	    </div>
	    <div class="xqbg main">
	        <div class="hd"> 
	            <h2>创意杂烩</h2>
	             <a class="more" target="_blank" href="<?php echo get_category_link(1)?>">阅读全部</a>
	        </div>
	        <div class="bd">
	        	<?php         	          				           
	                query_posts('posts_per_page=8&orderby=post_date');
	                if(have_posts()):$num = 0; 							
				   		while(have_posts()):
						$wp_query->the_post();
						$num++;
						if($num==1){echo '<ul class="mt20">';}
						if($num==5) { echo '</ul><ul class="list">';}
						if($num<5):
						?>
						
						<li <?php echo $num%2==1?'class="mr20"':''?>>
		                    <a href="<?php echo the_permalink();?>" target="_blank" class="pic"><?php echo getFirstImage(get_the_ID(),220,120)?></a>
		                    <p><a href="<?php echo the_permalink();?>" target="_blank" title="<?php echo get_the_title();?>"><?php echo mb_strimwidth(strip_tags(get_the_title()), 0, 30); ?></a></p>
		                </li>
		                
	            <?php else:?>
	            		<li <?php echo $num%2==1?'class="mr20"':''?>>
		                    <a href="<?php echo the_permalink();?>" target="_blank" title="<?php echo get_the_title();?>"><?php echo mb_strimwidth(strip_tags(get_the_title()), 0, 30); ?></a>
		                </li>
		         <?php endif; endwhile;
		         	echo '</ul>';
	            	endif;wp_reset_query();?>
	        </div>
	    </div>
    </div>
    <script type="text/javascript">
    	var index = {
			init:function(){
				
	            $('.flexslider').flexslider({manualControls:'.smpc li',directionNav:false});
			}
    	}
    	index.init();
    </script>
<?php get_footer(); ?>